// import com.alibaba.druid.sql.ast.SQLExpr_ptr;
// import com.alibaba.druid.sql.ast.SQLReplaceable;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "SQLExprStatement.h"
#include "../../visitor/SQLASTVisitor.h"

SQLExprStatement::SQLExprStatement()
{
}

SQLExprStatement::SQLExprStatement(SQLExpr_ptr expr)
{
  this->expr = expr;
}

//@Override
void SQLExprStatement::accept0(SQLASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(SQLExprStatement)))
  {
    acceptChild(visitor, expr);
  }
  visitor->endVisit(SharedObject(SQLExprStatement));
}

SQLExpr_ptr SQLExprStatement::getExpr()
{
  return expr;
}

void SQLExprStatement::setExpr(SQLExpr_ptr x)
{
  if (x != nullptr)
  {
    x->setParent(SharedObject(SQLExprStatement));
  }
  this->expr = x;
}

// @Override
BOOL_ptr SQLExprStatement::replace(SQLExpr_ptr expr, SQLExpr_ptr target)
{
  if (this->expr == expr)
  {
    setExpr(target);
    return BOOL::TRUE;
  }
  return BOOL::FALSE;
}
